<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>hello Vue</title>
</head>
<body>
<div id="app">
    <!-- v-on 绑定事件监听器 -->
    <!-- 有括号的无参数 -->
    <button v-on:click="but1()">按钮1</button>
    <!-- 不带括号的时候，click会获取原生DOM对象 -->
    <button v-on:click="but1">按钮1 DOM</button>
    <!--参数方法-->
    <button v-on:click="but2('参数1')">按钮2</button>
    <!--要参数又要有原生DOM对象，需要使用 $event-->
    <button v-on:click="but3('参数1', $event)">按钮3</button>
</div>
</body>
<script src="../css/vue.js"></script>
<script>
    const app = new Vue({
        el: "#app",
        methods: {
            but1(event) {
                console.log(event)
            },
            but2(param) {
                console.log(param)
            },
            but3(param, event) {
                console.log(param)
                console.log(event)
            }
        }
    });
</script>
</html>
